﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Contracts;

namespace Radar {

    public class Radar : MarshalByRefObject, IRadar, IRadarLocal {

        [Serializable]
        class Local : ILocal {

            readonly String _name;
            readonly float _speedLimit;
            readonly string _uid;
            readonly bool _isActive;

            public Local(String name, float speedLimit, String UID, bool isActive) {
                _name = name;
                _speedLimit = speedLimit;
                _uid = UID;
                _isActive = isActive;
            }

            public string GetName() { return _name; }
            public float GetSpeedLimit() { return _speedLimit; }
            public string GetUID() { return _uid; }
            public bool IsActive() { return _isActive; }
        }

        private readonly ILocal currentLocal = new Local("SomeName", 90, "38dh-44hdwwhsd-33", true);
        private readonly IRepository _rep = Repository.GetInstance();

        public Radar() { }

        public ILocal GetLocalInfo() { return currentLocal; }
        public void AddEvent(IEvent evt) { _rep.AddEvent(evt); }
        public List<IEvent> PeekEvents() { return _rep.PeekEvents(); }
        public List<IEvent> ReadEvents() { return _rep.ReadEvents(); }
    }
}
